#ifndef IO_H
#define IO_H

#include <stdio.h>
typedef volatile unsigned char tvPTR;

class IO
{                
     
     private:            
         bool data[8];

     protected:
         tvPTR *PORT;
         tvPTR *DDR; //data directions register 
                                
     public:
         
         IO(tvPTR *DATA, tvPTR *DIR);
         ~IO();
        // unsigned char notpointer;
    
        bool& operator[] (unsigned int i);   
        const bool& operator[] (unsigned int i) const;
        
        tvPTR& operator= (unsigned char  i);
        
        tvPTR& read();
        
        void write();
        tvPTR getbit(unsigned char bit);
        tvPTR* getPORT();
        tvPTR* getDDR();
        
        void set(unsigned char bit);
        void clr(unsigned char bit);
        void setoutput(unsigned char bit);
        void setinput(unsigned char bit);
        
        void print();      
        void error(){printf("error\n");}
};

#endif
